package com.设计模式.代理模式.动态代理.JDK动态代理;

import java.lang.reflect.Proxy;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/1  13:52
 * 描述:
 */
public class Test {

    public static void main(String[] args) {

       /* TestDaiLiInterface testDaiLiInterface=new TestDaiLiInterfaceImpl();

        MyInvocationHandler myInvocationHandler=new MyInvocationHandler(testDaiLiInterface);

        TestDaiLiInterface yyy = (TestDaiLiInterface)Proxy.newProxyInstance(TestDaiLiInterfaceImpl.class.getClassLoader()
                , TestDaiLiInterfaceImpl.class.getInterfaces(),myInvocationHandler );

        yyy.test01();*/


        MyInvocationHandler02 myInvocationHandler=new MyInvocationHandler02();
        Class<TestDaili02>[] classz= new Class[]{TestDaili02.class};

        TestDaili02 xxxx = (TestDaili02)Proxy.newProxyInstance(TestDaili02.class.getClassLoader()
                , classz, myInvocationHandler);

        String s = xxxx.test02();

        System.out.println(s);


    }

}
